/*    */ package com.zimbra.cs.service.mail;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class VerifyCode
/*    */   extends MailDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 34 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 35 */     String emailAddr = request.getAttribute("a");
/* 36 */     boolean success = false;
/* 37 */     if (SendVerificationCode.emailToCodeMap.containsKey(emailAddr)) {
/* 38 */       String code = request.getAttribute("code");
/* 39 */       if (((String)SendVerificationCode.emailToCodeMap.get(emailAddr)).equals(code)) {
/* 40 */         Account account = getRequestedAccount(zsc);
/* 41 */         account.setCalendarReminderDeviceEmail(emailAddr);
/* 42 */         success = true;
/* 43 */         SendVerificationCode.emailToCodeMap.remove(emailAddr);
/*    */       } else {
/* 45 */         ZimbraLog.misc.debug("Invalid verification code");
/*    */       }
/*    */     } else {
/* 48 */       ZimbraLog.misc.debug("Verification code for %s has either not been generated or has expired", new Object[] { emailAddr });
/*    */     }
/* 50 */     return zsc.createElement(MailConstants.VERIFY_CODE_RESPONSE).addAttribute("success", success ? "1" : "0");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/VerifyCode.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */